const http = require('http')
const fs = require('fs')


const server = http.createServer((request,response)=>{

    let {pathname} = new URL(request.url,'http://127.0.0.1:9000')
    if(pathname == "/"){
        let val = fs.readFileSync(__dirname + '/index.html')
        response.end(val)
    }else if(pathname == "/css/index.css"){
        let val = fs.readFileSync(__dirname + '/css/index.css')
        response.end(val)
    }else{
        response.statusCode = 404
        response.end('404')
    }
})

server.listen(9000,()=>{
    console.log('run server');
})



